﻿using System.Collections.Generic;
using System.Collections;
namespace ToyundaPhone.FileFormat
{
	public interface IRowGenerator
	{
		object[] GetNextRow();
	}

	public static class RowGeneratorExtensions
	{
		public static IEnumerator<object[]> AsEnumerator(this IRowGenerator generator)
		{
			object[] row = null;
			while ((row = generator.GetNextRow()) != null)
			{
				yield return row;
			}
		}

		public static IEnumerable<object[]> AsEnumerable(this IRowGenerator generator)
		{
			object[] row = null;
			while ((row = generator.GetNextRow()) != null)
			{
				yield return row;
			}
		}
	}
}
